# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=flowinspect
pkgver=97.34759ed
pkgrel=3
pkgdesc='A network traffic inspection tool.'
groups=('blackarch' 'blackarch-networking' 'blackarch-sniffer')
arch=('any')
url='https://github.com/7h3rAm/flowinspect'
license=('custom')
depends=('python2' 'python2-pylibemu' 'python2-re2' 'python2-pynids'
         'python2-yara' 'python2-fuzzywuzzy')
makedepends=('git')
source=("git+https://github.com/7h3rAm/$pkgname.git"
        'LICENSE')
sha512sums=('SKIP'
            '5ba00ca8f3dfa88fd2c5b2af7e5911bb3e962971f2089c6dd3ac0f304fae45b49c6b5e2a8ab2a7ca3ee7308ec99a581c8a20ee6cb4352408cdc29057d6118111')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/core"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 644 core/*.py "$pkgdir/usr/share/$pkgname/core/"
  install -Dm 755 flowinspect.py "$pkgdir/usr/share/$pkgname/flowinspect.py"
  install -Dm 644 issues "$pkgdir/usr/share/doc/$pkgname/issues"
  install -Dm 644 todo "$pkgdir/usr/share/doc/$pkgname/todo"
  install -Dm 644 $srcdir/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

